﻿using Microsoft.EntityFrameworkCore;
using TR.AppService.Dto.RKGLDto;
using TR.Domain.Entity;
using TR.Domain.Entity.BsItemType;
using TR.Domain.Entity.CKGL;
using TR.Domain.Entity.JH;
using TR.Domain.Entity.RK;
using TR.Domain.Entity.WH_return_;
using TR.Domain.Entity.WHOB;
using TR.Domain.Entity.XSDDGL;

namespace TR.EFCore
{
    public class MyContext : DbContext
    {
        public string conStr = "Data Source=rm-cn-omn3o8dvy000aako.sqlserver.rds.aliyuncs.com, 1433;Initial Catalog=TR;User ID=l_123;Password=Ff123456;Encrypt=False;";
        public MyContext(DbContextOptions<MyContext> options) : base(options)
        {
            //读取ui的配置信息
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //输出ef日志
            optionsBuilder.LogTo(msg =>
            {
                if (!msg.Contains("CommandExecuting"))
                {
                    return;
                }
                Console.WriteLine(msg);
            });
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

            //读取所有的配置类
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
        }

        //声明webApi需要 引用 cs类实现AppService文件中的对应方法
        public DbSet<Cs> Cs { get; set; }

        //编码规则表
        public DbSet<sys_Encode> Senc { get; set; }

        //供应商表
        public DbSet<bs_Supply> bs_Supply { get; set; }

        //财务表
        public DbSet<bs_Finance> bs_Finance { get; set; }

        //进货订单表
        public DbSet<wh_Buy_Order_h> wh_Buy_Order_H { get; set; }

        //进货详情表
        public DbSet<wh_orderbuy_d> wh_orderbuy_d {  get; set; }

        //进货订单详情查询
        public DbSet<JHXQ> JHXQ { get; set; }

        //进货订单表
        public DbSet<wh_Buy_Order_h> Wboh { get; set; }

        //进货订单信息表
        public DbSet<WHOB_Select> WHOM_Select { get; set; }

        //用户信息表
        public DbSet<rbac_User> rbac_User { get; set; }

        //货品类型表
        public DbSet<bs_Item_Type> bs_Item_Type {  get; set; }

        //货品信息表
        public DbSet<bs_Item> bs_Item { get; set; }

        public DbSet<ItemImage> itemImages { get; set; }
        //仓库表
        public DbSet<bs_WareHouse> bs_warehouses { get; set; }


        //销售订单
        public DbSet<XSdd> XSdd {  get; set; }

        //入库管理
        public DbSet<wh_Inbill_h> wh_Inbill_h { get; set; }
        
        //入库详情表
        public DbSet<wh_Inbill_d> wh_Inbill_d { get; set; }

        //入库主表视图
        public DbSet<RKGL_SelectZB> RKGL_SelectZB { get; set; }

        //入库明细视图
        public DbSet<RKMXXG> RKMXXG { get; set; }

        //入库关联单号视图
        public DbSet<GuanlianJHDH> GuanlianJHDH {  get; set; }

        //进货单号查询对应货品视图
        public DbSet<JHDHchaHP> JHDHchaHP { get; set; }

        //仓库管理
        public DbSet<bs_WareHouse> bs_warehouse { get; set; }

        //仓库库位表
        public DbSet<bs_Ware_Area> bs_Ware_Area { get; set; }

        //客户信息表
        public DbSet<bs_Customer> bs_Customer { get; set; }

        //销售订单表
        public DbSet<wh_Sale_h> wh_Sale_h { get; set; }

        //销售明细
        public DbSet<wh_Sale_d> wh_Sale_d { get; set; }

        //销售明细查询视图
        public DbSet<XsddXsxqCX> XsddXsxqCX { get; set; }

        //销售添加商品查询视图
        public DbSet<XsddTjSP> XsddTjSP { get; set; }

        //出库订单表
        public DbSet<wh_Outbill_h> wh_Outbill_h { get; set; }

        //出库明细表
        public DbSet<wh_Outbill_d> wh_Outbill_d { get; set; }

        //出库关联单号视图
        public DbSet<CKDHGuanlian> CKDHGuanlian { get; set; }

        //销售单号查询对应货品视图
        public DbSet<XSDHchaHP> XSDHchaHP { get; set; }

        //出库管理订单主表视图
        public DbSet<CKGL_SelectZB> CKGL_SelectZB { get; set; }

        //进货退货
        public DbSet<wh_return_suppy_h> wh_return_suppy_h { get; set; }
        //退货明细
        public DbSet<wh_return_suppy_d> wh_return_suppy_d { get; set; }

    }
}
